import request from '@/utils/request'

// 获取组织架构的
export const getDeptListAPI = () => {
  return request({
    method: 'get',
    url: '/company/department'
  })
}
// 删除部门详情
export const delDeptAPI = deptId => {
  return request({
    method: 'delete',
    url: `/company/department/${deptId}`
  })
}

// 获取部门负责人列表
export const getManagerListAPI = () => {
  return request({
    method: 'get',
    url: '/sys/user/simple'
  })
}

// 添加新增部门
export const addDeptAPI = deptForm => {
  return request({
    method: 'post',
    url: '/company/department',
    data: deptForm
  })
}
/**
 * 获取部门详情
 * @param {*} deptId 部门id
 * @returns
 */
export const getDeptDetailAPI = deptId => {
  return request({
    method: 'get',
    url: `/company/department/${deptId}`
  })
}

/**
 * 获取编辑部门
 * @param {*} deptForm 部门表单
 * @returns
 */
export const editDeptAPI = deptForm => {
  return request({
    method: 'put',
    url: `/company/department/${deptForm.id}`,
    data: deptForm
  })
}
